package cn.com.darly.videoandroidpm.widget.dialog;

import android.app.Dialog;
import android.content.Context;
import android.widget.ImageView;

import com.darly.dview.widget.camera.util.ImageLoaderUtil;

import cn.com.darly.videoandroidpm.R;

/**
 * @author Darly/张宇辉/2018/5/4 14:06
 * @version 1.0/cn.com.darly.videoandroidpm.widget.dialog
 */
public class ImageLoadingDialog extends Dialog {
    public ImageLoadingDialog(Context context) {
        super(context, R.style.ImageloadingDialogStyle);
    }

    public ImageLoadingDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    private ImageView iv;


    public void setImageResouce(int resid){
        if (iv == null){
            iv = findViewById(R.id.id_dialog_image);
            iv.setImageResource(resid);
        }else {
            iv.setImageResource(resid);
        }
    }

    public void setImageResouce(String  url){
        if (iv == null){
            iv = findViewById(R.id.id_dialog_image);
            ImageLoaderUtil.getInstance().loadImageNor(url,iv);
        }else {
            ImageLoaderUtil.getInstance().loadImageNor(url,iv);
        }
    }

}
